package com.gof.example.algorithm;

/**
 * Created with IntelliJ IDEA.
 * Created by zhiyuan on 2018/5/13 15:15.
 * haiming.fei@tongdun.cn
 */
public enum TakeOff {
    VerticalTakeOff("垂直起飞", 1),LongDistanceTakeOff("长距离起飞", 2);
    private String name;
    private int value;

    TakeOff(String name, int value) {
        this.name = name;
        this.value = value;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getValue() {
        return value;
    }

    public void setValue(int value) {
        this.value = value;
    }

    public static TakeOff getByValue(int v) {
        TakeOff[] values = values();
        for (int i = 0; i < values.length; i++) {
            TakeOff takeOff = values[i];
            if (takeOff.getValue() == v) {
                return takeOff;
            }
        }

        return null;
    }
}
